package com.hundsun.s3.platform.monitor.action;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hundsun.jresplus.common.util.StringUtil;
import com.hundsun.s3.common.dto.PageBean;
import com.hundsun.s3.common.dto.SR;
import com.hundsun.s3.monitor.service.MonitorService;

/**
 * 
 * <p>Title:MonitorAction</p>
 * <p>Description: </p>
 * <p>Company: Hundsun</p>
 * @author :zhangwc23609
 * @date :2018年3月2日 下午1:52:23
 */

@Controller
@RequestMapping("/sr")
public class MonitorAction {
	
	@Autowired
	private MonitorService monitorService;
	
	/**
	 * 
	 * @Description:根据staffId来查看时间差
	 * @return
	 * @author: zhangwc23609
	 * @date: 2018年3月2日 下午5:32:18
	 */
	@RequestMapping("/srQryById.json")
	@ResponseBody
	public Map<String, Object> srQueryById(@RequestParam(value = "staffId") String staffId,
										   @RequestParam(value = "pageSize") int pageSize,
										   @RequestParam(value = "pageNo") int pageNo){
		
		PageBean pageBean = new PageBean();
		pageBean.setPNoPSize(pageNo, pageSize);
		if(StringUtil.isEmpty(staffId)){
			staffId = "0";
		}
		Map map = monitorService.getSRById(staffId, pageBean);
		Map<String, Object> rs = new HashMap<>();
		rs.put("rows", (List<SR>) (map.get("list")));
		rs.put("total", ((PageBean) map.get("page")).getCount());
		return rs;
	}
	
	
}
